{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "71bf2b6a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# %load denoising_utils.py\n",
    "import os\n",
    "from .common_utils import *\n",
    "\n",
    "\n",
    "        \n",
    "def get_noisy_image(img_np, sigma):\n",
    "    \"\"\"Adds Gaussian noise to an image.\n",
    "    \n",
    "    Args: \n",
    "        img_np: image, np.array with values from 0 to 1\n",
    "        sigma: std of the noise\n",
    "    \"\"\"\n",
    "    \"\"\"   \n",
    "    img_noisy_np = np.clip(img_np + np.random.normal(scale=sigma, size=img_np.shape), 0, 1).astype(np.float32)\n",
    "    img_noisy_pil = np_to_pil(img_noisy_np)\n",
    "\n",
    "    return img_noisy_pil, img_noisy_np\n",
    "    \"\"\"\n",
    "    img_noisy_np = np.clip(img_np + np.random.normal(scale=sigma, size=img_np.shape), 0, 1).astype(np.float32)\n",
    "\n",
    "    return img_noisy_np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "45ce8b77",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\Desktop\\SUnCNN-main\\utils\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "\n",
    "# 查看当前工作目录\n",
    "print(os.getcwd())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
